<?php
namespace Admin\Controller;

use Think\Controller;

// 右边栏
class RightController extends SignInController
{
    public function __construct()
    {
        parent::__construct();
        layout("common/layout");
    }

    // 获取产品下拉框
    public function getProductList()
    {
        $list = array("" => "");
        $products = M('Product')->field("id,name")->where(array("isDelete" => "2","isUp" => "1"))->select();
        for ($j = 0; $j < count($products); $j++) {
            $product = $products[$j];
            $key = $product['id'];
            $list[$key] = $product['name'];
        }
        return $list;
    }

    // 是否是管理
    public function isAdmin(){
        return $this->getAccount()['role'] == "1";
    }

    // 是否是分公司
    public function isCompany(){
        return $this->getAccount()['role'] == "2";
    }
}